﻿-- =========================================================================================================
-- Author:		MICHAEL RITACCO
-- Copyright:	2010 MEKHANO GROUP LLC
-- Version:		08/21/2010 1.0
-- =========================================================================================================
CREATE FUNCTION [flcrTM].[GetTMPeriodKey](@period_date datetime = null)
RETURNS int
AS
BEGIN
	DECLARE @ret int;
	 SELECT @ret = [TIME_KEY] FROM flcrTm.[PERIOD]
		           WHERE [PERIOD_DATE] = COALESCE(@period_date,CAST(GETDATE() as date))
	RETURN @ret
END